package com.ocm.tourism.core.dao.jpa;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.ocm.tourism.core.dao.MapInfoDao;
import com.ocm.tourism.core.domain.MapInfo;

@Repository
public class JpaMapInfoDao extends JpaGenericDao<MapInfo> implements MapInfoDao {
    public JpaMapInfoDao(){
        setClazz(MapInfo.class);
    }

    @Override
    public long count() {
        return entityManager().createQuery("SELECT COUNT(m) FROM MapInfo m", Long.class).getSingleResult();
    }

    @Override
    public List<MapInfo> findAll() {
        return entityManager().createQuery("SELECT m FROM MapInfo m", MapInfo.class).getResultList();
    }

}
